-
Notifications
You must be signed in to change notification settings - Fork 5k
Replace Python tests with GO test #45503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
We should rename and split |
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
|
||
def test_registrar_file_content(self): | ||
""" | ||
Check if registrar file is created correctly and content is as expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existence of registry and its contents is already tested by
https://github.com/khushijain21/beats/blob/onweek1/filebeat/tests/integration/filestream_truncation_test.go#L70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few minor comments. Thanks for your work on this and for cleaning up the tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see the framework evolving as we see more test-cases.
There are a few minor comments. I would approve after the got addressed.
|
||
config := ` | ||
filebeat.inputs: | ||
- type: log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd encourage to test the filestream
input only because log
is deprecated.
Also, there is known issue with --once
#33718
|
||
config := ` | ||
filebeat.inputs: | ||
- type: container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's test filestream
with the container
parser instead as described here https://www.elastic.co/docs/reference/beats/filebeat/filebeat-input-container.
The container
input is now deprecated.
} | ||
} | ||
|
||
type registryEntry struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything registry should be in a separate file and be available to all the tests as a set of helper functions.
|
||
config := ` | ||
filebeat.inputs: | ||
- input_type: log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be another test for the container
input as well. Expect the same behavior.
} | ||
|
||
// counts number of lines in the given file and asserts if it matches expected count | ||
func CountLinesInFile(t *testing.T, path string, count int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be near the integration.GenerateLogFile
function as a part of the framework.
InputDoc := mapstr.M{ | ||
"message": "sample dummy message", | ||
"fields": mapstr.M{ | ||
"number": 20, | ||
"slice": []string{"20", "30", "40"}, | ||
}, | ||
"isthisboolean": false, | ||
"nilValue": nil, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to have raw JSON here, then parse it to mapstr.M
and test the whole cycle. So, we're as close to the real use-case as possible.
} | ||
|
||
// GetTempDir implements the BeatTest interface. | ||
func (b *beatTest) GetTempDir() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Proposed commit message
This PR moves Python tests to GO
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.